package com.ssm.dao;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.ssm.entity.Score;

public class ScoreSqlProvider {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table score
     *
     * @mbggenerated
     */
    public String insertSelective(Score record) {
        BEGIN();
        INSERT_INTO("score");
        
        if (record.getId() != null) {
            VALUES("Id", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getStudentId() != null) {
            VALUES("student_id", "#{studentId,jdbcType=INTEGER}");
        }
        
        if (record.getCourseId() != null) {
            VALUES("course_id", "#{courseId,jdbcType=INTEGER}");
        }
        
        if (record.getScore() != null) {
            VALUES("score", "#{score,jdbcType=DOUBLE}");
        }
        
        return SQL();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table score
     *
     * @mbggenerated
     */
    public String updateByPrimaryKeySelective(Score record) {
        BEGIN();
        UPDATE("score");
        
        if (record.getStudentId() != null) {
            SET("student_id = #{studentId,jdbcType=INTEGER}");
        }
        
        if (record.getCourseId() != null) {
            SET("course_id = #{courseId,jdbcType=INTEGER}");
        }
        
        if (record.getScore() != null) {
            SET("score = #{score,jdbcType=DOUBLE}");
        }
        
        WHERE("Id = #{id,jdbcType=INTEGER}");
        
        return SQL();
    }
}